package com.cskaoyan.advice;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.stereotype.Component;

/**
 * @author stone
 * @date 2022/09/30 17:25
 */
@Component
public class KFCAdvice implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        System.out.println("西红柿片、酸黄瓜、生菜");
        // Object invoke = method.invoke(bean, objects); → 执行委托类方法
        Object proceed = methodInvocation.proceed();
        System.out.println("芝士片、生菜");
        return proceed;
    }
}
